package com.epoque.admin.ui.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.epoque.admin.ui.rpc.IUserService;

/**
 * 
 * @ClassName: UserPermissionController
 * @Description: 用户权限控制类
 * @author qiuxianfeng
 * @date 2018年8月29日
 *
 */
@Controller
public class UserPermissionController  extends BaseController{
    @Autowired
    private IUserService userService;

    @RequestMapping(value = "/user/system",method = RequestMethod.GET)
    @ResponseBody
    public String getUserSystem(){
       return userService.getSystemsByUsername(getCurrentUserName());
    }
    @RequestMapping(value = "/user/menu",method = RequestMethod.GET)
    @ResponseBody
    public String getUserMenu(@RequestParam(defaultValue = "-1") Integer parentId){
        String menu = userService.getMenusByUsername(getCurrentUserName(),parentId);
        return menu;
    }
}
